package r21310.chap04.d1106;

public class Test {
    public static void main(String[] args) {
        //正方形方法的方法的调用
        Square square=new Square();
        System.out.println(square.getArea(10));
        System.out.println(square.getLength(10));

    }

}
abstract class Shape{
    //获得面积
    public abstract double getArea(double x);
    //获得周长
    public abstract double getLength(double y);
}
//必须实现父类的抽象方法
class Square extends Shape{

    @Override
    public double getArea(double x) {
        return x*x;//返回的是可以是算法这里是正方形面积
    }

    @Override
    public double getLength(double y) {
        return 4*y;
    }
}
class Circle extends Shape{
    @Override
    public double getArea(double x) {
        return x*x*3.14;
    }

    @Override
    public double getLength(double y) {
        return 2*y*4.14;
    }
}